const dataPermissionAPI = {
  // 维护规则API
  queryRuleList: param => {
    return $http.post(`${window.RPConfig.mgt}/datapolicy/list/page`, param).then(response => response.data);
  },
  addRule: param => {
    return $http.post(`${window.RPConfig.mgt}/datapolicy/add`, param).then(response => response.data);
  },
  updateRule: param => {
    return $http.post(`${window.RPConfig.mgt}/datapolicy/update`, param).then(response => response.data);
  },
  deleteRule: ids => {
    return $http.post(`${window.RPConfig.mgt}/datapolicy/delete?ids=${ids}`).then(response => response.data);
  },
  queryDimensionList: param => {
    return $http
      .post(`${window.RPConfig.mgt}/datapolicydimension/findDimensionWithAllot`, param)
      .then(response => response.data);
  },
  updateRuleAndDimension: param => {
    return $http
      .post(`${window.RPConfig.mgt}/datapolicydimension/updateDimensionRelList`, param)
      .then(response => response.data);
  },
  // 查询已分配的维度
  queryAssignedDimension: param => {
    return $http.post(`${window.RPConfig.mgt}/datapolicydimension/list/findAll`, param).then(response => response.data);
  },
  // 维度分配角色API
  queryAssignedRole: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyAssignmentBiz/list/pageRole`, param)
      .then(response => response.data);
  },
  queryUnassignedRole: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyAssignmentBiz/list/pageRoleUnallocated`, param)
      .then(response => response.data);
  },
  saveAssignedRole: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyAssignmentBiz/allotAssignment`, param)
      .then(response => response.data);
  },
  deleteAssignedRole: ids => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyAssignmentBiz/delete?ids=${ids}`)
      .then(response => response.data);
  },
  // 维度分配用户API
  queryAssignedUser: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyAssignmentBiz/list/pageUser`, param)
      .then(response => response.data);
  },
  queryUnassignedUser: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyAssignmentBiz/list/pageUserUnallocated`, param)
      .then(response => response.data);
  },
  saveAssignedUser: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyAssignmentBiz/allotAssignment`, param)
      .then(response => response.data);
  },
  deleteAssignedUser: ids => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyAssignmentBiz/delete?ids=${ids}`)
      .then(response => response.data);
  },
  // 维度数据API
  queryAssignedListDimensionData: param => {
    return $http.post(`${window.RPConfig.mgt}/dataPolicyPermission/list/page`, param).then(response => response.data);
  },
  queryListDimensionData: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyPermission/list/pageUnallocated`, param)
      .then(response => response.data);
  },
  saveAssignedListDimensionData: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyPermission/list/allotPermission`, param)
      .then(response => response.data);
  },
  deleteAssignedListDimensionData: ids => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyPermission/list/delete?ids=${ids}`)
      .then(response => response.data);
  },
  queryTreeDimensionData: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyPermission/tree/findAll`, param)
      .then(response => response.data);
  },
  saveAssignedTreeDimensionData: param => {
    return $http
      .post(`${window.RPConfig.mgt}/dataPolicyPermission/tree/allotPermission`, param)
      .then(response => response.data);
  },
  getDimensionDataUrl: data => $http.post(`${window.RPConfig.mgt}/dimensionDataUrl/list/page`, data).then(response => response.data),
  queryOrgTreeDimensionData: data => $http.post(`${window.RPConfig.mgt}/dataPolicyPermission/orgData/findAll`, data).then(response => response.data),
  getOrgDataByPath: param => $http.get(`${window.RPConfig.mgt}/organization/getOrgDataByPath`, param).then(response => response.data),
  getAuthorizedOrgsNew: param => $http.get(`${window.RPConfig.mgt}/organization/getAuthorizedOrgsNew`, param)
};
export default dataPermissionAPI;
